package com.viknix.mysql.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;

/**
 * @Author: Dongqi
 * @Date: 2021/11/4 20:00
 * @Version 1.0
 * @Description:
 */
@Slf4j
@SpringBootApplication
public class MysqlDemoApplication {

    public static void main(String[] args) {
        ConfigurableEnvironment env = SpringApplication.run(MysqlDemoApplication.class, args).getEnvironment();
        String local = null;
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            local = localHost.getHostAddress();
        } catch (Exception e) {
            log.warn(">>> localHost is null！");
            local = "127.0.0.1";
        }
        String port = env.getProperty("server.port");
        log.info("Access URLs:\n----------------------------------------------------------\n\t"
                + "Local: \t\thttp://{}:{}\n\t", local, port);
    }
}
